<template>
  <div>
    <div>
      <group title="我的账号">
        <!-- <cell :title="staffIdOnLogin"></cell> -->
        <cell :title="staffIdOnLogin" @click.native="showPlugin()" is-link>
          <div slot="value">
            <span style="color: green">退 出</span>
          </div>
        </cell>
      </group>
      <group>
        <cell title="个人资料" link="/tabbar/mydetail"></cell>
        <cell title="修改密码" link="/tabbar/pwd"></cell>
      </group>
    </div>
  </div>
</template>

<script>
import { Cell, CellBox, CellFormPreview, Group, Badge, Card, Confirm, XButton} from 'vux'

export default {
  components: {
    Group,
    Cell,
    CellFormPreview,
    CellBox,
    Badge,
    Card,
    Confirm,
    XButton
  },
  data: function () {
    var ms_staffId = localStorage.getItem('ms_staffId')
    return {
      memberlist: [],
      money: null,
      showContent001: false,
      monthScore: '',
      C: '',
      seasonScore: '',
      seasonRank: '',
      monthInfoMap: '',
      seasonInfoMap: '',
      staffIdOnLogin: ms_staffId,
      name: '',
      staff: false,
      admin: false
    }
  },
  mounted: function () {
  },
  methods: {
    monthInfo: function () {
      var self = this
      self.$ajax({
        method: 'get',
        url: '../wx/info',
        params: {
          staffId: self.staffIdOnLogin,
          scoreType: 2
        }
      })
      .then(function (res) {
        self.monthInfoMap = res.data[0]
        self.monthScore = self.monthInfoMap.totalScore
        self.monthRank = self.monthInfoMap.rank
      })
      .catch(function (err) {
        console.log(err)
      })
    },
    showPlugin () {
      var self = this
      this.$vux.confirm.show({
        title: '退出登录',
        content: '退出当前账号',
        onConfirm () {
          self.$ajax({
            method: 'get',
            url: '../logout',
            params: {
            }
          })
          .then(function (res) {
            self.message = res.message
            if (self.message === 'logout') {
              localStorage.setItem('ms_staffId', '')
              self.$router.replace('/')
            }
          })
          .catch(function (err) {
            console.log(err)
          })
        }
      })
    }
  }
}
</script>

<style lang="less">
.card-demo-flex {
  display: flex;
}
.card-demo-content01 {
  padding: 10px 0;
}
.card-demo-flex > div {
  flex: 1;
  text-align: center;
  font-size: 12px;
}
.demo-icon {
  margin-right: 15px;
}
</style>